package com.yootk;


import java.util.concurrent.atomic.AtomicReference;

class Book {
    private String title;
    private double price;

    public Book(String title, double price) {
        this.title = title;
        this.price = price;
    }

    @Override
    public String toString() {
        return "[图书] 名称 = " + this.title + " , 价格 = " + this.price;
    }
}

public class YootkDemo4 {
    public static void main(String[] args) throws Exception {
        Book book = new Book("Java就业编程实战", 69.8);
        AtomicReference<Book> ref = new AtomicReference<Book>(book);
        ref.compareAndSet(book, new Book("Spring就业编程实战", 67.8));
        System.out.println(ref);
    }
}